package com.zhkj.txg.module.home.popup

import android.content.Context
import android.view.Gravity
import android.view.View
import android.widget.TextView
import com.zhkj.txg.R
import razerdp.basepopup.BasePopupWindow

class ConfirmDeletePopupWindow(
    context: Context,
    private val onConfirm: () -> Unit
) : BasePopupWindow(context) {

    init {
        popupGravity = Gravity.CENTER
        setOutSideDismiss(false)
    }

    override fun onCreateContentView(): View = createPopupById(R.layout.popup_receive_confirm)

    override fun onViewCreated(contentView: View?) {
        contentView?.let {
            it.findViewById<TextView>(R.id.tvTitle).text = context.getString(R.string.confirm_delete_search_key)
            it.findViewById<TextView>(R.id.etMemberNickname).text =
                context.getString(R.string.confirm_delete_search_key_hint)
            it.findViewById<View>(R.id.tvUserNicknameCancel).setOnClickListener { dismiss() }
            it.findViewById<View>(R.id.tvUserNicknameConfirm).setOnClickListener {
                dismiss()
                onConfirm()
            }
        }
    }
}